package com.mty.cc.service.impl;


import com.mty.cc.mapper.ScoreMapper;
import com.mty.cc.po.Score;
import com.mty.cc.service.ScoreService;
import com.mty.cc.util.uuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ScoreServiceImpl implements ScoreService {

    @Autowired(required=false)
    private ScoreMapper scoreMapper;

    /*
     * @description: 添加
     * @author: mty
     */
    @Override
    public void add(Score score) {
        score.setId(uuid.getRandomIdByUUID());
        scoreMapper.insert(score);
    }

    /*
     * @description: 按照主键更新
     * @author: mty
     */
    @Override
    public void update(Score score) {
        scoreMapper.update(score);
    }

    /*
     * @description: 按照ID删除
     * @author: mty
     */
    @Override
    public void deleteById(String id) {
        scoreMapper.deleteById(id);
    }

    /*
     * @description: 查询全部
     * @author: mty
     */
    @Override
    public List<Score> queryByAll() {
        return scoreMapper.queryByAll();
    }

    @Override
    public List<Score> queryByAll2() {
        return scoreMapper.queryByAll2();
    }

    @Override
    public List<Score> scoreStatic() {
        return scoreMapper.scoreStatic();
    }

    @Override
    public List<Score> queryByAllAndStudent(String username) {
        return scoreMapper.queryByAllAndStudent(username);
    }

    /*
     * @description: 根据ID查询
     * @author: mty
     */
    @Override
    public Score queryById(String id) {
        return scoreMapper.queryById(id);
    }
}

